<%--
    Document   : update fragment for task
    Created on : Mar 10, 2014, 10:54:45 PM
    Author     : Anton Strack
--%>
<div class="csd_content_form">
    <form method="POST" action="${config.getPath()}">
        <div class="form-group">
            <label class="form-control" for="name">Name:</label>
            <input class="form-control" id="name" name="name" required="" autofocus="" type="text" value="${bean.name}"><br />
            <input type="hidden" name="id" id="id" value="${bean.id}" />
            <label class="form-control" for="description">Description:</label>
            <textarea class="form-control ckeditor" id="description" name="description" required="" rows="20">${bean.description}</textarea><br />
            <label class="form-control" for="action">Task Action:</label>
            <p>Select the primary action of the task.</p>
            <select class="form-control" id="action" name="action">
                <c:forEach items="${actions}" var="action" >
                    <c:choose>
                        <c:when test="${bean.actionTypeId == action.id}">
                            <option value="${action.id}" selected="selected">${action.name}</option>
                        </c:when>
                        <c:otherwise>
                            <%-- if the postId isn't zero then that means there is a resource attached to the task and thus any task action is allowed. --%>
                            <c:if test="${bean.postId != 0}">
                                <option value="${action.id}">${action.name}</option>
                            </c:if>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
            </select><br />
        </div>
        <button class="btn btn-primary" type="submit" name="formSubmit" id="formSubmit" value="update-task">Save ${bean.name}</button>
    </form>
</div>

